#lang racket/base
(provide
 check-not-false^1
 check-match^1)

(require
 (for-syntax
  racket/match
  racket/base)
 rackunit
 syntax/parse/define)

(define-simple-macro (check-not-false^1 e)
  #:with [tmp1 tmp2] (generate-temporaries #'[tmp tmp])
  (begin
    (begin-for-syntax
      (define tmp1 (and e #f)))
    (define-syntax (tmp2 stx)
      #`'#,tmp1)
    (check-not-false (tmp2))))

(define-simple-macro (check-match^1 e p)
  #:with [tmp1 tmp2] (generate-temporaries #'[tmp tmp])
  (begin
    (begin-for-syntax
      (define tmp1
        (match e
          [p #f]
          [_ 'p])))
    (define-syntax (tmp2 stx)
      #`'#,tmp1)
    (cond
      [(tmp2) => (λ (r) (fail r))]
      [else (check-true #t)])))
